package cn.minhx.domain.trade.moedel.valobj;

import java.util.Arrays;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
 * 拼团订单枚举
 *
 * @author min
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
public enum GroupBuyOrderEnumVO {
	PROGRESS(0, "拼单中"), COMPLETE(1, "完成"), FAIL(2, "失败"),;

	private Integer code;
	private String info;

	public static GroupBuyOrderEnumVO valueOf(Integer code) {
		return Arrays.stream(values()).filter(item -> item.code.equals(code)).findFirst()
				.orElseThrow(() -> new RuntimeException("err code not exist!"));
	}
}
